//
//  ENSharesCell.m
//  EverydayNews
//
//  Created by 李沛池 on 2017/8/6.
//  Copyright © 2017年 Godlike. All rights reserved.
//

#import "ENSharesCell.h"
#import "SharesModel.h"

@interface ENSharesCell ()

@property (weak, nonatomic) IBOutlet UILabel *labelSharesName;
@property (weak, nonatomic) IBOutlet UILabel *labelSharesCode;
@property (weak, nonatomic) IBOutlet UILabel *labelSharesDiffMoney;
@property (weak, nonatomic) IBOutlet UILabel *labelSharesDiffRate;

@end

@implementation ENSharesCell

- (void)updateData:(SharesModel *)model
{
    _labelSharesName.text = model.name;
    _labelSharesCode.text = model.code;
    _labelSharesDiffMoney.text = [NSString stringWithFormat:@"%.2f",model.nowPrice];
    _labelSharesDiffRate.text = [NSString stringWithFormat:@"%@%%",model.diff_rate];
    
    UIColor *sharesColor = COLOR_RED_Shares;
    if ([model.diff_rate floatValue] < 0) {
        sharesColor = COLOR_GREEN_Shares;
    }else {
        _labelSharesDiffRate.text = [NSString stringWithFormat:@"+%@%%",model.diff_rate];
    }
    _labelSharesDiffMoney.textColor = sharesColor;
    _labelSharesDiffRate.textColor = sharesColor;
}

@end
